package com.itboye.mengwu.data.repository;

import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.google.gson.reflect.TypeToken;
import com.itboye.core.interfaces.ICompleteListener;
import com.itboye.core.utils.BaseErrorListener;
import com.itboye.core.utils.BaseSuccessReqListener;
import com.itboye.core.utils.ByJsonRequest.Builder;
import com.itboye.mengwu.data.interfaces.IMyTieziinterfaces;
import com.itboye.mengwu.data.model.MyTiezibean;

public class MyTieZirepsotry extends BaseNetRepository implements
		IMyTieziinterfaces<MyTiezibean> {
	public static final String QueryMyTiezi = "BY_BbsUserCenter_queryThread";// 查询我的帖子
	public static final String onClick = "BY_ForumThread_favorites";// 查询我的帖子
	String api = "100";

	public MyTieZirepsotry(ICompleteListener listener) {
		// TODO Auto-generated constructor stub
		super(listener);
	}

	@Override
	public void add(MyTiezibean model) {
		// TODO Auto-generated method stub

	}

	@Override
	public void delete(MyTiezibean model) {
		// TODO Auto-generated method stub

	}

	@Override
	public void update(MyTiezibean model) {
		// TODO Auto-generated method stub

	}

	@Override
	public void getInfo(MyTiezibean model) {
		// TODO Auto-generated method stub
		Type type = new TypeToken<ArrayList<MyTiezibean>>() {
		}.getType();
		String apiVer = api;
		Map<String, Object> map = new HashMap<String, Object>();// page_no否
																// page_size否
																// uid否
																// img_num返回最新主题帖的图片个数默认3
		map.put("uid", model.getUid());
		(new Builder<ArrayList<MyTiezibean>>())
				.setTypeVerParamsAndReturnClass(QueryMyTiezi, apiVer, map, type)
				.requestListener(
						new BaseSuccessReqListener<ArrayList<MyTiezibean>>(
								getListener()))
				.errorListener(new BaseErrorListener(getListener()))
				.desEncodeThenBuildAndSend();
	}

	@Override
	public List<MyTiezibean> queryYouHuiQuan(MyTiezibean model) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void onClickShouCang(String tid, String uid, String favorite_value) {
		// TODO Auto-generated method stub
		Type type = new TypeToken<ArrayList<String>>() {
		}.getType();
		String apiVer = api;
		Map<String, Object> map = new HashMap<String, Object>();// page_no否
																// page_size否
																// uid否
																// img_num返回最新主题帖的图片个数默认3
		map.put("tid", tid);
		map.put("uid", uid);
		map.put("favorite_value", favorite_value);
		(new Builder<String>())
				.setTypeVerParamsAndReturnClass(onClick, apiVer, map, type)
				.requestListener(
						new BaseSuccessReqListener<String>(getListener()))
				.errorListener(new BaseErrorListener(getListener()))
				.desEncodeThenBuildAndSend();
	}

}
